package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;


public class MainActivity6 extends AppCompatActivity {
    ImageView img_avatar;
    TextView tv1,tv2;
    Button btn_neon, btn_star, btn_photo, btn_sql;
    Button btn_home, btn_tv, btn_dynamic, btn_mine, btn_revise;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main6);
        initView();
        btn_revise();
        btn_neon();
        btn_star();
        btn_photo();
        btn_sql();
        //btn_home();
        //btn_tv();
        //btn_dynamic();
        //btn_mine();
        //btn_remove();
    }

    private void btn_revise() {
        btn_revise.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent4 = new Intent();
                intent4.setClass(MainActivity6.this, MainActivity2.class);
                startActivity(intent4);
            }
        });
    }

    private void btn_home() {
        btn_home.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(MainActivity6.this, MainActivity3.class);
                startActivity(intent);
            }
        });
    }

    private void btn_tv() {
        btn_tv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent1 = new Intent();
                intent1.setClass(MainActivity6.this, MainActivity4.class);
                startActivity(intent1);
            }
        });
    }

    private void btn_dynamic() {
        btn_dynamic.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent2 = new Intent();
                intent2.setClass(MainActivity6.this, MainActivity5.class);
                startActivity(intent2);
            }
        });
    }

    private void btn_mine() {
        btn_mine.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent3 = new Intent();
                intent3.setClass(MainActivity6.this, MainActivity6.class);
                startActivity(intent3);
            }
        });
    }

    //    private void btn_remove() {
//        btn_remove.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                Intent intent1 = new Intent(MainActivity6.this,MainActivity2.class);
//                startActivity(intent1);
//                finish();
//            }
//        });
//    }
    //@SuppressLint("WrongViewCast")
    private void initView() {
        img_avatar=findViewById(R.id.imageView_avatar);
        tv1=findViewById(R.id.textView_name);
        tv2=findViewById(R.id.textView_constellation);
        btn_neon = findViewById(R.id.button_neon);
        btn_star = findViewById(R.id.button_star);
        btn_photo = findViewById(R.id.button_photo);
        btn_sql = findViewById(R.id.button_sql);
        btn_home = findViewById(R.id.button_home);
        btn_tv = findViewById(R.id.button_tv);
        btn_dynamic = findViewById(R.id.button_dynamic);
        btn_mine = findViewById(R.id.button_mine);

        btn_revise = findViewById(R.id.button_massage_revise);
    }

    private void btn_neon() {
        btn_neon.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent5 = new Intent();
                intent5.setClass(MainActivity6.this, MainActivity3.class);
                startActivity(intent5);
            }
        });
    }

    private void btn_star() {
        btn_star.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent6 = new Intent();
                intent6.setClass(MainActivity6.this, MainActivity3.class);
                startActivity(intent6);
            }
        });
    }

    private void btn_photo() {
        btn_photo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent7 = new Intent();
                intent7.setClass(MainActivity6.this, MainActivity3.class);
                startActivity(intent7);
            }
        });
    }

    private void btn_sql() {
        btn_sql.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent8 = new Intent(MainActivity6.this, SqlActivity.class);
                startActivity(intent8);
                finish();
            }
        });
    }
}
//    public static class imageButton_sql extends LinearLayout {
//        private final Object imageButton_sql;
//        //<span style="white-space:pre">	</span>private ImageView ImageButton;
//        //<span></span>
//        private TextView textView;
//
//        public imageButton_sql(Context context,AttributeSet attrs) {
//            super(context, attrs);
//
//            imageButton_sql = new ImageView(context, attrs);
//
//            imageButton_sql.setPadding(0, 0, 0, 0);
//
//            textView = new TextView(context, attrs);
//            //设置文字水平居中
//            textView.setGravity(Gravity.CENTER_HORIZONTAL);
//
//            textView.setPadding(0, 0, 0, 0);
//            //进行点击监听
//            setClickable(true);
//
//            setFocusable(true);
//
//            setBackgroundResource(android.R.drawable.btn_default);
//            //垂直布局
//            setOrientation(LinearLayout.VERTICAL);
//
//            addView(imageViewbutton);
//
//            addView(textView);
//        }
//    public class imageButton_sql<style> extends androidx.appcompat.widget.AppCompatImageButton {
//
//        private String text = null;
//        private int color;
//        //private span;
//        public imageButton_sql(Context context, AttributeSet attrs) {
//            super(context, attrs);
//        }
//
//        public void setText(String text){
//            this.text = text;
//        }
//
//        public void setColor(int color){
//            this.color = color;
//        }
//
//	<span style="color:#ff0000;">protected void onDraw(Canvas canvas)</span>{
//            Canvas canvas = new Canvas();
//            super.onDraw(canvas);
//            Paint paint = new Paint();
//            paint.setTextAlign(Paint.Align.CENTER);
//            paint.setColor(color);
//            canvas.drawText(text, 15, 20, paint);
//        }
//    }
    //<span style="font-family: Arial, Helvetica, sans-serif;">loginBtn = (imageButton_sql) this.findViewById(R.id.imageButton_sql);</span>
    //<span style="font-family: Arial, Helvetica, sans-serif;">loginBtn.setText("登录");</span>
    //<span style="font-family: Arial, Helvetica, sans-serif;">loginBtn.setColor(Color.WHITE);</span>
//}